<?php
$post = $_POST;
if($post['sign']!='fsd854j909kl349'){
	Afun_json('sign error');exit;
}
if($post['data']){
	$data = $post['data'];
	if(is_array($data)){
		foreach ($data as $k => $v) {
			$rs[$k] = Afun_sms($v['phone'],$v['note']);
		}
	}
	Afun_json($rs);
}
function Afun_sms($phone,$note){
	$sms = apibus::init( "sms"); //创建短信服务对象
	$obj = $sms->send( $phone, $note , "UTF-8");
	//错误输出 Tips: 亲，如果调用失败是不收费的
	if ( $sms->isError( $obj ) ) {
		$rs->errcode = $obj->ApiBusError->errcode;
		$rs->errdesc = $obj->ApiBusError->errdesc;
	}
	$rs->rs = $obj;
	return $obj;
}
function Afun_json($data){
	//输出JSON字符串
	ob_end_clean();ob_start();
	header('Content-type: application/json; charset=UTF-8');
	echo json_encode($data);
	exit;
}
?>